<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        div{
            width: 100px;
            height: 100px;
            background-color: springgreen;

            /* 如果我们想要让盒子给动起来,那么需要给盒子添加一个定位 */
            position: absolute;
            top: 0;
            left: 0;
        }
    </style>
</head>
<body>
    <div></div>
    <script>
        /* 
            目的是 : 点击盒子的时候,让盒子往右边移动400px
        */
        const box = document.querySelector("div")
        box.onclick = function(){
            //点击盒子让盒子往右边移动400px
            this.style.left = 400 + 'px'
        }
    </script>
</body>
</html>